package org.distributed.transaction.core.context;

import org.aspectj.lang.ProceedingJoinPoint;
import org.distributed.transaction.core.annotion.TccTransaction;

/**
 * Tcc 事务信息
 * 
 * @author jiatui
 *
 */
public class TccTransactionInfo extends TransactionInfo {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 事务状态
	 */
	private TransactionStatus transactionStatus;

	/**
	 * 回滚方法名称
	 */
	private String cancelMethod;

	/**
	 * 提交名称
	 */
	private String confirmMethod;

	public TccTransactionInfo() {
	}

	public TccTransactionInfo(ProceedingJoinPoint point) throws Throwable {
		super(point);
		TccTransaction tccTransaction = getBusinessMethod().getAnnotation(TccTransaction.class);
		this.confirmMethod = tccTransaction.confirm();
		this.cancelMethod = tccTransaction.cancel();
	}

	public TransactionStatus getTransactionStatus() {
		return transactionStatus;
	}

	public void setTransactionStatus(TransactionStatus transactionStatus) {
		this.transactionStatus = transactionStatus;
	}

	public String getCancelMethod() {
		return cancelMethod;
	}

	public void setCancelMethod(String cancelMethod) {
		this.cancelMethod = cancelMethod;
	}

	public String getConfirmMethod() {
		return confirmMethod;
	}

	public void setConfirmMethod(String confirmMethod) {
		this.confirmMethod = confirmMethod;
	}

}
